package cn.bossfriday.im.access.server;

import cn.bossfriday.im.common.enums.access.ConnectState;
import cn.bossfriday.im.protocol.client.ClientInfo;
import cn.bossfriday.im.protocol.client.MqttMessageCallback;
import io.netty.util.AttributeKey;

import java.util.concurrent.ConcurrentHashMap;

/**
 * AccessContextAttributeKey
 *
 * @author chenx
 */
public class AccessContextAttributeKey {

    private AccessContextAttributeKey() {
        // do nothing
    }

    /**
     * global
     */
    public static final AttributeKey<String> SESSION_ID = AttributeKey.valueOf("AccessContext.sessionId");
    public static final AttributeKey<Long> APPID = AttributeKey.valueOf("AccessContext.appId");

    /**
     * connect
     */
    public static final AttributeKey<Boolean> IS_CHANNEL_ACTIVE = AttributeKey.valueOf("AccessContext.isChannelActive");
    public static final AttributeKey<Boolean> IS_CONNECTED = AttributeKey.valueOf("AccessContext.isConnected");
    public static final AttributeKey<String> DISCONNECT_REASON = AttributeKey.valueOf("AccessContext.disconnectReason");
    public static final AttributeKey<ConnectState> CONN_STATE = AttributeKey.valueOf("AccessContext.connectState");

    /**
     * client
     */
    public static final AttributeKey<String> USERID = AttributeKey.valueOf("AccessContext.userId");
    public static final AttributeKey<ClientInfo> CLIENT_INFO = AttributeKey.valueOf("AccessContext.clientInfo");
    public static final AttributeKey<Integer> CLIENT_MESSAGE_ID = AttributeKey.valueOf("AccessContext.clientMessageId");
    public static final AttributeKey<Integer> SERVER_MESSAGE_ID = AttributeKey.valueOf("AccessContext.serverMessageId");
    public static final AttributeKey<Integer> LAST_PUBLISH_COUNTER = AttributeKey.valueOf("AccessContext.lastPublishCounter");
    public static final AttributeKey<Long> LAST_PUBLISH_TIMESTAMP = AttributeKey.valueOf("AccessContext.lastPublishTimestamp");

    /**
     * callback
     */
    public static final AttributeKey<ConcurrentHashMap<Integer, MqttMessageCallback.PublishCallback>> PUBLISH_CALLBACK = AttributeKey.valueOf("AccessContext.publishCallback");
    public static final AttributeKey<ConcurrentHashMap<Integer, MqttMessageCallback.QueryCallback>> QUERY_CALLBACK = AttributeKey.valueOf("AccessContext.queryCallback");
}
